//
//  ShopCircleOrderOverView.m
//  AmountBody
//
//  Created by liuchen on 2018/1/3.
//  Copyright © 2018年 RCMTM. All rights reserved.
//

#import "OrderProcessingInfosView.h"
#import <Masonry/Masonry.h>
@interface OrderProcessingInfosView()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) UILabel *detailLabel;
@property (nonatomic,strong) UIImageView *lineImageView;
@property (nonatomic,strong) UITableView *shopCircleOrderTableView;

@property (nonatomic,strong) UIView *maskView;//遮罩
@end
@implementation OrderProcessingInfosView

- (void)startSlideAnimation {
    self.alpha = 1;
    [_maskView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(self).multipliedBy(0.001);
    }];
    [UIView animateWithDuration:1 animations:^{
        [self layoutIfNeeded];
    }];
}

- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        //创建视图
        [self createSubView];
    }
    return self;
}

#pragma mark - 懒加载tableView
- (UITableView *)shopCircleOrderTableView{
    if (!_shopCircleOrderTableView) {
        _shopCircleOrderTableView = [[UITableView alloc]initWithFrame:CGRectMake(75*UNITSCALELC, 80*UNITSCALELC, 750*UNITSCALELC, 280*UNITSCALELC) style:UITableViewStylePlain];
        _shopCircleOrderTableView.delegate = self;
        _shopCircleOrderTableView.dataSource = self;
        _shopCircleOrderTableView.showsVerticalScrollIndicator = NO;
        _shopCircleOrderTableView.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ytj_s_back"]];
        _shopCircleOrderTableView.showsHorizontalScrollIndicator = NO;
        _shopCircleOrderTableView.tableFooterView = [[UIView alloc]init];
    }
    return _shopCircleOrderTableView;
}

#pragma mark - 创建视图
- (void)createSubView{
    
    //添加控件
    self.detailLabel = [[UILabel alloc] init];
    _detailLabel.textAlignment = NSTextAlignmentRight;
    _detailLabel.textColor = RGBColorAlpha(56, 56, 56, 0.7);
    _detailLabel.font = [UIFont systemFontOfSize:SCREEN_W*0.012];
    _detailLabel.text = @"共处理17个订单  成功8个订单  失败9个订单";
    [self addSubview:_detailLabel];
    [_detailLabel mas_updateConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self).offset(20);
    }];

    [self addSubview:self.shopCircleOrderTableView];

    self.lineImageView = [[UIImageView alloc] init];
    _lineImageView.image = [UIImage imageNamed:@"order_processing_line"];
    self.maskView = [[UIView alloc] init];
    _maskView.backgroundColor = [UIColor whiteColor];
    [self addSubview:_lineImageView];
    [self addSubview:_maskView];

    [_lineImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_detailLabel.mas_bottom);
        make.left.equalTo(_maskView.mas_right).offset(60);
    }];

    [_maskView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.equalTo(self);
        make.width.equalTo(self);
        make.top.equalTo(self);
    }];
}


#pragma mark - TableView代理方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 10;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LCCELL"];
    
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"LCCELL"];
        cell.backgroundColor = [UIColor clearColor];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.textLabel.text = @"ST12122         成功";
    return cell;
}


@end
